package com.chanzany.factory.simpleFactory.improve;



public class Client {
    public static void main(String[] args) {
        order("greek");
    }

    public static void order(String type) {
        Pizza pizza = SimpleFactory.createPizza(type);
        //输出pizza 制作过程
        pizza.prepare();
        pizza.bake();
        pizza.cut();
        pizza.box();
    }
}

abstract class Pizza {
    protected String name;

    public abstract void prepare();

    public void bake() {
        System.out.println(name + " baking;");
    }

    public void cut() {
        System.out.println(name + " cutting;");
    }

    public void box() {
        System.out.println(name + " boxing;");
    }

    public void setName(String name) {
        this.name = name;
    }
}

class CheesePizza extends Pizza {
    @Override
    public void prepare() {
        System.out.println(name + " preparing;");
    }
}

class GreekPizza extends Pizza {
    @Override
    public void prepare() {
        System.out.println(name + " preparing;");
    }
}

class PepperPizza extends Pizza {
    @Override
    public void prepare() {
        System.out.println(name + " preparing;");
    }
}
